import Vue from "vue";
import VueRouter from 'vue-router';
import Main from "./components/Main";
import PosDialog from "./components/PosDialog";
import PosLoading from "./components/PosLoading.vue";
import request from "./request";
import * as vClickOutside from 'v-click-outside-x';
import dayjs from "dayjs";
import PosConfirm from "./components/confirm";
import PosApp from "./components/PosApp.vue";

Vue.use(VueRouter);
Vue.use(vClickOutside);
Vue.use(PosConfirm);
Vue.component(PosDialog.name, PosDialog);
Vue.component(PosLoading.name, PosLoading);

Vue.prototype.$http = request;
Vue.prototype.$beep = new Audio(posSettings.root + '/audio/beep.mp3');
Vue.prototype.$toAmount = function (v) {
    return parseFloat(v).toFixed(2);
}

Vue.prototype.$imageSrc = function (src) {
    return src.replace('http://noodlebox.test.com', 'https://noodlebox.ie');
}

Vue.prototype.$dayjs = dayjs;

const router = new VueRouter({
    routes: [
        {path: '/', component: PosApp}
    ]
});

new Vue({
    router,
    render(createElement, hack) {
        return createElement(Main);
    }
}).$mount('#app');